KML: nail directional icons to map for rotation. Don't crash on GPX files that
authorrobertl <robertl>
Thu, 6 Mar 2008 03:40:02 +0000 (03:40 +0000)
committerrobertl <robertl>
Thu, 6 Mar 2008 03:40:02 +0000 (03:40 +0000)
  have links w/o text.
Bump version.

configure
configure.in
gbversion.h
kml.c
testo

index 19be3ea6c6448550f8ac1f74c1612ec1d18bbca8..a7bb3a6e772614ed1f1ce6f2514af8d25bfc6ca9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1744,7 +1744,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 # YYYYMMDD, please, if beta, i.e. "-beta20060413"
-PACKAGE_RELEASE="-beta20080217"
+PACKAGE_RELEASE="-beta20080305"
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_RELEASE "$PACKAGE_RELEASE"
index 71af6daf37f1fb6c8c7e4081030593e85e6eec2c..c2556113dcf6f9b271e53131a5f62c6dfcb25395 100644 (file)
@@ -6,7 +6,7 @@ AC_PREREQ(2.59)
 AC_INIT(GPSBabel, 1.3.5, BUG-REPORT-ADDRESS)
 
 # YYYYMMDD, please, if beta, i.e. "-beta20060413"
-PACKAGE_RELEASE="-beta20080217"
+PACKAGE_RELEASE="-beta20080305"
 AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "$PACKAGE_RELEASE", [Define to the release name of this package.])
 AC_SUBST(PACKAGE_RELEASE)
 
index da86fcbacd9be87ef4a3a4a0926f778ec4279e92..e7a13d1b41a116c4225bf5745c1988fa0975befe 100644 (file)
@@ -4,5 +4,5 @@
  *
  * Isn't simplification via automation grand?
  */
-#define VERSION "1.3.5-beta20080217"
+#define VERSION "1.3.5-beta20080305"
 #define WEB_DOC_DIR "http://www.gpsbabel.org/htmldoc-1.3.5"
diff --git a/kml.c b/kml.c
index 88dffe405ce64bd723a32527dedfd30c55bf2d09..102f1ca2a2b9ec277528b64ccf26da3280acdb49 100644 (file)
--- a/kml.c
+++ b/kml.c
@@ -402,7 +402,7 @@ kml_write_xmle(const char *tag, const char *v)
 
 #define hovertag(h) h ? 'h' : 'n'
 static void kml_write_bitmap_style_(const char *style, const char * bitmap, 
-                                   int highlighted)
+                                   int highlighted, int force_heading)
 {
        kml_write_xml(0, "<!-- %s %s style -->\n", 
                highlighted ? "Highlighted" : "Normal", style);
@@ -411,6 +411,10 @@ static void kml_write_bitmap_style_(const char *style, const char * bitmap,
        if (highlighted) {
                kml_write_xml(0, "<scale>1.2</scale>\n");
        }
+       /* Our icons are pre-rotated, so nail them to the maps. */
+       if (force_heading) {
+               kml_write_xml(0, "<heading>0</heading>\n");
+       }
        kml_write_xml(1, "<Icon>\n");
        kml_write_xml(0, "<href>%s</href>\n", bitmap);
        kml_write_xml(-1, "</Icon>\n");
@@ -425,17 +429,18 @@ static void kml_write_bitmap_style_(const char *style, const char * bitmap,
 static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap,
                                  const char *customstyle)
 {
+       int force_heading = 0;
        const char *style;
        switch (pt_type) {
                case kmlpt_track: style = "track"; break;
                case kmlpt_route: style = "route"; break;
                case kmlpt_waypoint: style = "waypoint"; break;
-               case kmlpt_other: style = customstyle; break;
+               case kmlpt_other: style = customstyle; force_heading = 1; break;
                default: fatal("kml_output_point: unknown point type"); break;
        }
 
-       kml_write_bitmap_style_(style, bitmap, 0);
-       kml_write_bitmap_style_(style, bitmap, 1);
+       kml_write_bitmap_style_(style, bitmap, 0, force_heading);
+       kml_write_bitmap_style_(style, bitmap, 1, force_heading);
 
        kml_write_xml(1, "<StyleMap id=\"%s\">\n", style);
        kml_write_xml(1, "<Pair>\n");
@@ -851,13 +856,17 @@ static void kml_geocache_pr(const waypoint *waypointp)
        kml_write_xml(1, "<ExtendedData>\n");
        kml_write_xml(0, "<Data name=\"gc_num\"><value>%s</value></Data>\n", waypointp->shortname);
 
-       p = xml_entitize(waypointp->url_link_text);
-       kml_write_xml(0, "<Data name=\"gc_name\"><value>%s</value></Data>\n", p);
-       xfree(p);
+       if(waypointp->url_link_text) {
+               p = xml_entitize(waypointp->url_link_text);
+               kml_write_xml(0, "<Data name=\"gc_name\"><value>%s</value></Data>\n", p);
+               xfree(p);
+       }
 
-       p = xml_entitize(waypointp->gc_data.placer);
-       kml_write_xml(0, "<Data name=\"gc_placer\"><value>%s</value></Data>\n", p);
-       xfree(p);
+       if (waypointp->gc_data.placer) {
+               p = xml_entitize(waypointp->gc_data.placer);
+               kml_write_xml(0, "<Data name=\"gc_placer\"><value>%s</value></Data>\n", p);
+               xfree(p);
+       }
 
        kml_write_xml(0, "<Data name=\"gc_placer_id\"><value>%d</value></Data>\n", waypointp->gc_data.placer_id);
 
diff --git a/testo b/testo
index 5e5cd0dc19c425dc37ef6648fd890ab468c0163f..e9b3ca012819fafa21ac034a0975d42d9088d265 100755 (executable)
--- a/testo
+++ b/testo
@@ -1289,7 +1289,7 @@ compare ${TMPDIR}/navilink_tracks_gpx.trk ${REFERENCE}/navilink_tracks_gpx.trk
 # MTK logger tests
 #
 rm -f ${TMPDIR}/mtk_logger.*
-${PNAME} -t -i mtk-bin,csv=${TMPDIR}/mtk_logger.csv -f ${REFERENCE}/track/mtk_logger.bin -o gpx -F ${TMPDIR}/mtk_logger.gpx
+${PNAME} -t -w -i mtk-bin,csv=${TMPDIR}/mtk_logger.csv -f ${REFERENCE}/track/mtk_logger.bin -o gpx -F ${TMPDIR}/mtk_logger.gpx
 compare ${TMPDIR}/mtk_logger.gpx ${REFERENCE}/track/mtk_logger.gpx
 ## CSV compare needs to be done with '-w' - ignore whitespace.
 compare ${TMPDIR}/mtk_logger.csv ${REFERENCE}/track/mtk_logger.csv